<template>
    <div>
        <el-descriptions title="生命体征">
            <el-descriptions-item label="身高cm" >{{ lifeInfo.height }}</el-descriptions-item>
            <el-descriptions-item label="体重kg" >{{ lifeInfo.weight }}</el-descriptions-item>
            <el-descriptions-item label="体温 ℃" >{{ lifeInfo.temperature }}</el-descriptions-item>
            <el-descriptions-item label="脉搏 次/分" >{{ lifeInfo.pulse }}</el-descriptions-item>
            <el-descriptions-item label="收缩压 mmHg" >{{ lifeInfo.systolicPressure }}</el-descriptions-item>
            <el-descriptions-item label="舒张压 mmHg" >{{ lifeInfo.diastolicPressure }}</el-descriptions-item>
            <el-descriptions-item label="测量人" >{{ lifeInfo.measureBy }}</el-descriptions-item>
            <el-descriptions-item label="测量时间" >{{ lifeInfo.measureTime }}</el-descriptions-item>

        </el-descriptions>
    </div>
</template>
<script>
import { method } from "lodash";
import { selectPatientVitalSignsByPatientId } from "@/service/api.js";

export default {
    props: {
        patientId: {
            type: [Number, String],
        },
    },
    data() {
        return {
            lifeInfo: {}
        };
    },
    watch: {
        patientId: {
            immediate: true,
            handler(val) {
                if (val) {
                    this.init();
                }
            },
        },
    },
    methods: {
        init() {
            selectPatientVitalSignsByPatientId({
                patientId: this.patientId,
            }).then((res) => {
                this.lifeInfo = res.data;
                // if (res.success) {
                //     this.$alert(
                //         `
                //             <div>
                //                 <p>身高: ${res.data.height} cm</p>
                //                 <p>体重: ${res.data.weight} kg</p>
                //                 <p>体温: ${res.data.temperature} ℃</p>
                //                 <p>脉搏: ${res.data.pulse} 次/分</p>
                //                 <p>收缩压: ${res.data.systolicPressure} mmHg</p>
                //                 <p>舒张压: ${res.data.diastolicPressure} mmHg</p>
                //             </div>
                //         `,
                //         "患者体征信息",
                //         {
                //             dangerouslyUseHTMLString: true,
                //         }
                //     );
                // }
            });
        },
    },
};
</script>
